package org.nanotek.cms.domain;

import java.util.Date;
import java.util.Set;

import org.nanotek.StringKong;
import org.nanotek.cms.domain.lucene.Index;

@SuppressWarnings("serial")
public class MediaDetail extends StringKong{

	private Long size;
	private Link originLink;
	private String location;
	private Date dateUpdate;
	private Character readable;
	private Link referenceLink;
	private String contentType;
	private Set<Index> indexes;

	public MediaDetail() {
		super(Long.toString(System.currentTimeMillis()));
	}

	public String getLocation() {
		return location;
	}

	public void setLocation(String location) {
		this.location = location;
	}

	public String getContentType() {
		return contentType;
	}

	public void setContentType(String contentType) {
		this.contentType = contentType;
	}

	public Long getSize() {
		return size;
	}

	public void setSize(Long size) {
		this.size = size;
	}


	public Date getDateUpdate() {
		return dateUpdate;
	}

	public void setDateUpdate(Date dateUpdate) {
		this.dateUpdate = dateUpdate;
	}

	public Character getReadable() {
		return readable;
	}

	public void setReadable(Character readable) {
		this.readable = readable;
	}

	@Override
	public String toString() {
		return "MediaDetails [location=" + location + ", contentType="
				+ contentType + ", size=" + size + ", dateUpdate=" + dateUpdate
				+ ", readable=" + readable + "]";
	}

	public Link getReferenceLink() {
		return referenceLink;
	}

	public void setReferenceLink(Link referenceLink) {
		this.referenceLink = referenceLink;
	}

	public Link getOriginLink() {
		return originLink;
	}

	public void setOriginLink(Link originLink) {
		this.originLink = originLink;
	}

	public Set<Index> getIndexes() {
		return indexes;
	}

	public void setIndexes(Set<Index> indexes) {
		this.indexes = indexes;
	}


	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((dateUpdate == null) ? 0 : dateUpdate.hashCode());
		result = prime * result + ((innerKong == null) ? 0 : innerKong.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		MediaDetail other = (MediaDetail) obj;
		if (dateUpdate == null) {
			if (other.dateUpdate != null)
				return false;
		} else if (!dateUpdate.equals(other.dateUpdate))
			return false;
		if (innerKong == null) {
			if (other.innerKong != null)
				return false;
		} else if (!innerKong.equals(other.innerKong))
			return false;
		return true;
	}

}
